﻿using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using DBSourceToolsLib;
using DBConnectionLib;

namespace TestDBSourceToolsLibNUnit
{
    [TestFixture]
    [Ignore]
    public class TestScriptOptions
    {
        [Test]
        public void TestWriteScriptOptionsFile()
        {
            FileHelper oFileHelper = new FileHelper();
            oFileHelper.DeleteFilesInDir(BaseDirectoryHelper.TestFiles_output);

            DBSourceToolsLib.DatabaseProject oDBProject = new DatabaseProject(
                BaseDirectoryHelper.TestFiles_output, "DBSourceToolsTestDB");

            Stubs.NewDatabaseProjectFormStub oStub = new TestDBSourceToolsLibNUnit.Stubs.NewDatabaseProjectFormStub();
            oDBProject.AddNewDatabase(oStub.GetDBSourceToolsTestDB());

            UserSettings.Instance().DatabaseProject = oDBProject;
            SourceDatabase oSource = UserSettings.Instance().getSourceDatabase("DBSourceToolsTestDB");

            oSource.ScriptOptions.ScriptData = false;
            oSource.ScriptOptions.ScriptDropAndCreate = true;
            oSource.ScriptOptions.ScriptStoredProcs = true;
            oSource.ScriptOptions.ScriptTables = true;
            oSource.ScriptOptions.ScriptUsers = true;
            oSource.ScriptOptions.ScriptViews = true;

            oSource.ScriptOptions.WriteToDisk();

            string strControlFile = BaseDirectoryHelper.TestFiles_control_DBSourceToolsTestDB + "\\ScriptOptions.xml";
            string strWrittenFile = oDBProject.BaseDirectory + "\\" + oDBProject.ProjectName + "\\ScriptOptions.xml";
            oFileHelper.CompareFiles(strControlFile, strWrittenFile);

        }


    }
}
